unit UntTableInfo_Dis;

interface

uses
  UntTableInfo, DBClient,DB;

type

  TImportDataelegateFunc = function ( cds: TClientDataSet): Integer of object;
  TTableInfo_Dis = class(TTableInfo)
  public
    importdate : TImportDataelegateFunc;
    function SaveData(cds: TClientDataSet): Integer; override;
    procedure formatToCDS(cds: TClientDataSet); override;
  end;

implementation

procedure TTableInfo_Dis.formatToCDS(cds: TClientDataSet);
var lindex :Integer;
begin
  //inherited;
  cds.Close;
  cds.FieldDefs.Clear;
  //cds.FieldDefs.Add('style',ftString,20);
  cds.FieldDefs.Add('BarCode',ftString,20);
  cds.FieldDefs.Add('discount',ftFloat);
  cds.FieldDefs.Add('discountPrice',ftFloat);
  cds.FieldDefs.Add('qty',ftInteger);
  if cds.FieldDefs.Count>0 then
  begin
    cds.CreateDataSet;
    lindex :=0;
    while lindex<cds.Fields.Count do
    begin
      cds.Fields[lindex].DisplayWidth :=20;
      inc(lindex);
    end;
  end;
end;

function TTableInfo_Dis.SaveData(cds: TClientDataSet): Integer;
begin
  Result := importdate(cds);//inherited SaveData(cds);
end;

end.
